<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>AdminLTE 2 | General Form Elements</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/adminlte/bower_components/Ionicons/css/ionicons.min.css}">
    <link rel="stylesheet" th:href="@{/bootstrap-table/bootstrap-table.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/adminlte/css/AdminLTE.min.css}">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" th:href="@{/adminlte/css/skins/_all-skins.min.css}">

    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>




    <script th:src="@{/adminlte/bower_components/jquery/dist/jquery.min.js}"></script>
    <script th:src="@{/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- FastClick -->
    <script th:src="@{/adminlte/bower_components/fastclick/lib/fastclick.js}"></script>
    <!-- AdminLTE App -->
    <script th:src="@{/adminlte/js/adminlte.min.js}"></script>
    <!-- AdminLTE for demo purposes -->
    <script th:src="@{/adminlte/js/demo.js}"></script>


    <script th:src="@{/bootstrap-table/bootstrap-table.min.js}"></script>
    <script th:src="@{/bootstrap-table/locale/bootstrap-table-zh-CN.js}"></script>
    <![endif]-->

    <!-- Google Font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!--    引入公共类头部文件-->
    <div th:replace="common/bar::topbar"></div>
    <!-- 左侧菜单页面-->

    <div th:replace="common/bar::#sidebar"></div>

    <!--不能抽取的内容显示页-->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Employee 管理
                <small>Preview</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">Forms</a></li>
                <li class="active">General Elements</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-info">
                        <div class="box-body">
                            <table id="dataTable" class="table table-hover table-responsive"
                                   style="table-layout: fixed"></table>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>

    <!--尾部代码-->
    <div th:replace="common/bar::#footerbar"></div>

    <!--控制代码-->
    <div th:replace="common/bar::#controlbar"></div>
</div>
<script>
    $('#dataTable').bootstrapTable({
        method: 'get',
        url: "/employees/api/search",
        toolbar: '#toolbar',
        striped: true,
        dataField: "employees",
        pageNumber: 1,
        pagination: true,
        queryParamsType: 'limit',
        queryParams:queryParams,
        sidePagination: 'server',
        pageSize: 20,
        pageList: [10, 20, 50, 100],
        showRefresh: false,
        clickToSelect: true,
        toolbarAlign: 'left',
        buttonsAlign: 'right',
        showColumns: true,
        columns: [
            {
                title: '全选',
                field: 'select',
                checkbox: true,
                width: 25,
                align: 'center',
            },
            {
                title: 'ID',
                field: 'employeeId',
                visible: false,
                width: 160
            },
            {
                title: 'Edit',
                width: 50,
                formatter: function (value, row, index, field) {
                    return [
                        '<a class="edit ml10" href="javascript:void(0)" title="Edit">',
                        '<i class="glyphicon glyphicon-edit"></i>',
                        '</a>',
                    ].join('');
                },
                events: {
                    'click .edit': function (e, value, row, index) {
                        window.location.href = '/category/edit?id' + row.id;
                    }
                },
                align: 'center'
            },
            {
                title: 'Name',
                field: 'firstName',
                width: 160,
                align: 'center'
            },
            {
                title: 'Parent Category',
                field: 'parentCategory',
                width: 160,
                align: 'center'
            },
            {
                title: 'URL',
                field: 'url',
                width: 160,
                align: 'center'
            },
            {
                title: 'template',
                field: 'template',
                width: 160,
                align: 'center'
            }
        ],
        locale: 'zh-CN',
        responseHandler: function (data) {
            return data;
        }
    });
    function queryParams(params) {
        return {
            pageSize: params.limit,
            pageNum: params.offset / params.limit + 1
        }
    }
</script>
</body>
</html>
